package stringExertises;

/**
 * @author: snail_mount
 * @date: 20/2/3 1:54
 * @description: String的转换功能api
 */
public class TransformFunction {
    public static void main(String[] args) {
//        将字符串转换为新的字符数组
        String str = "abcdefg";
        char[] c = str.toCharArray();
        for (int i = 0; i < c.length; i++) {
            System.out.print(c[i] + ",");
        }
//        将字符串转换为字节数组
        byte[] bytes = str.getBytes();
        for (byte aByte : bytes) {
            System.out.print(aByte + ",");
        }
//        替换
        System.out.println(str.replace("abc", "RED"));

    }
}
